home *** CD-ROM | disk | FTP | other *** search
/ MacWorld 1999 February / Macworld (1999-02).dmg / Games World / Hot Demos! / DroidWorks demo / dwCD.gob / mission_cog_b0_hermittalk.cog < prev    next >
Text File  |  1998-09-17  |  11KB  |  339 lines

  1. # b_0 HermitDroid.cog
  2. #    
  3. # A simple communiCog That I pioneered.  -Doug
  4. #
  5. # Desc:
  6. #
  7. #
  8. # 12/08/97 DGS    taken from JawaTalk. 
  9. #-----------------------------------------------------------------------------
  10.  
  11. symbols
  12.     message        converse
  13.     message       startup
  14.     message        user1
  15.     message        arrived
  16.     message        taken
  17.     message        timer
  18.  
  19.     thing        Gonk
  20.     thing       player                           local
  21.     template    large_gear        
  22.     thing        gear_ghost
  23.  
  24.     int        Met=0                            local
  25.     int        Joke=0                               local
  26.     int        spoken_1=0                       local
  27.     int        gears=0                            local
  28.     int        ConversationActive=0            local
  29.     int     gonkcurframe=0                      local
  30.     int        ResponseID                        local
  31.     int        message=0                        local
  32.     int        thing_i=0                        local
  33.     int        bat_i=18                        local
  34.     flex        wait_time=1.3                local
  35. end
  36.  
  37.  
  38. code
  39. startup:
  40.     hastalked=0;
  41.         return;
  42. taken:
  43.     if ((getsenderref() == thing_i)&&(dwgetarmstrength()>8) )
  44.         {
  45.         destroything(thing_i);
  46.         SetInvAvailable(getlocalplayerthing(), 27, 1);//    Add the large gear to the INV
  47.         ChangeInv(getlocalplayerthing(), 27, 1);
  48.         dwFlashInventory();
  49.         timermode = 2;
  50.         dwPlayCammySpeech(17309, "t9ca010.wav", 10, 0);
  51.         settimer(10);
  52.         }
  53.    else {
  54.           print("you're not strong enough to pick that up!");  
  55.           dwplaycammyspeech(16022, "m2ca022.wav", 20, 2); 
  56.      }       return;
  57.      
  58. converse:
  59.     if ((getsenderref() == gonk) || (ConversationActive    == 1))
  60.     {
  61.     # What response did the player select?
  62.     ResponseID = dwGetPlayerResponse();
  63.     print("conversation started!");
  64.     
  65.      if (ResponseID == 0 && !ConversationActive)
  66.         {
  67.         # Response 0 is reserved to indicate that a conversation is starting
  68.         ConversationActive = 1;   
  69.         dwfreezeplayer();
  70.         playsong(0,0,0);
  71.         ResponseID = 1;
  72.         playerpos=getthingpos(getlocalplayerthing());
  73.         AISetMoveSpeed(gonk, 0);
  74.         AISetLookPos(gonk, playerpos);
  75.         }
  76.     
  77.     if (ResponseID == 1)                  #beginning Node          
  78.         {
  79.         if (met == 2)
  80.             {
  81.             //dwSetDialogText("HDC002");        # Anything else
  82.             dwplayplayerresponse();
  83.             dwplaycharacterspeech("HDC002","T9GK003.wav");
  84.             }
  85.         if (met == 1)
  86.             {
  87.             //dwSetDialogText("HDC001");        # Hello
  88.             dwplaycharacterspeech("HDC001","T9GK002.wav");
  89.             met = 2; 
  90.             }
  91.             
  92.         if (met ==0)
  93.             {
  94.             //dwSetDialogText("HDC000");        # Greets                        
  95.             dwplaycharacterspeech("HDC000","T9GK001.wav");
  96.             met = 2;
  97.             }
  98.         dwAddResponse(100, "HDP100","T9xx007.wav",71);        //# bridge move?
  99.         if (gears == 0) dwAddResponse(200, "HDP200","T9xx008.wav",72);             // # Gears?
  100.         if (gears == 1) dwAddResponse(210, "HDP210","T9xx009.wav",73);             // # Gears?
  101.         if ((getdifficulty() == 0) && (joke == 0)) dwAddResponse(301, "HDP301","T6xx012.wav",72);  // # Joke #1
  102.         if ((getdifficulty() == 0) && (joke == 1)) dwAddResponse(300, "HDP305","T9xx013.wav",72);  // # what are you doing here?
  103.         if ((getdifficulty() == 1) && (joke == 0)) dwAddResponse(303, "HDP303","T9xx012.wav",72);  // # Joke #2
  104.         if ((getdifficulty() == 2) && (joke == 0)) dwAddResponse(305, "HDP303","T9xx012.wav",72); // # Joke #3
  105.                 
  106.         //if (joke  == 3) dwAddResponse(300, "HDP300");           // # Finally tell him
  107.                 
  108.         dwAddResponse(400, "HDP400","IDxx222.wav",20);            // # Goodbye.
  109.         }
  110.  
  111.     if (ResponseID == 100)    //            # Bridge
  112.         {
  113.         dwplayplayerresponse();
  114.         //dwSetDialogText("HDC100"); 
  115.         dwPlayCharacterSpeech("HDC100", "T9Gk005.wav");        
  116.         dwAddResponse(1, "HDP001","T3xx002.wav",60);           // Back to root node (ID 1);
  117.         }
  118.         
  119.     if (ResponseID == 200)    //            # Gears #1
  120.         {
  121.         dwplayplayerresponse();
  122.         //dwSetDialogText("HDC200"); 
  123.         dwPlayCharacterSpeech("HDC200", "T9GK006.wav");        
  124.         dwAddResponse(210, "HDP210","T9xx009.wav",71);               
  125.         dwAddResponse(1, "HDP001","t3xx002.wav",60);        // Thanks   
  126.         gears = 1;
  127.         }
  128.          
  129.      if (ResponseID == 210)    //            Can I have the big gear?
  130.          {
  131.         //printint(GetInv(getlocalplayerthing(), 16));
  132.         if (getdifficulty() != 2)  
  133.             {
  134.             dwplayplayerresponse();
  135.             //dwSetDialogText("HDC210"); // I need a battery 
  136.             dwPlayCharacterSpeech("HDC210", "T9GK007.wav");        
  137.             if (GetInv(getlocalplayerthing(), bat_i) > 0)     //if battery inv bin is greater than 0
  138.                 {
  139.                 dwAddResponse(211, "HDP211","T9xx014.wav",30);                  // Deal       
  140.                 dwAddResponse(212, "HDP212","T9xx015.wav",50);               // Let me think about it
  141.                 }
  142.             else
  143.                 {
  144.                 printint((GetInv(getlocalplayerthing(), bat_i)));
  145.                 dwAddResponse(213, "HDP213","T9xx016.wav",40);                    // I don't have any more.       
  146.                 }
  147.             }
  148.         else    // Else difficult does equal 2    
  149.             {
  150.             dwplayplayerresponse();
  151.             //dwSetDialogText("HDC215"); // I need a juice-up. 
  152.             dwPlayCharacterSpeech("HDC215", "T9GK008.wav");        
  153.             message = 0;
  154.             if (dwCheckDroidCaps(65536))
  155.                 {
  156.                 // Juice Me Up
  157.                 dwAddResponse(216, "HDP211","T9xx014.wav",30);      // It's a deal       
  158.                 dwAddResponse(212, "HDP212","T9xx015.wav",60);               // Let me think about it
  159.                 }
  160.             else                
  161.                 {
  162.                 // Need a Power plug 
  163.                 //dwAddResponse(219, "HDP215");// I don't have a power plug       
  164.                 dwAddResponse(219, "HDP215","T9xx018.wav",40);    // I don't have a power plug       
  165.                 }
  166.             }
  167.         }
  168.         
  169.     if (ResponseID == 216)    //            # It's a deal Part3
  170.         {
  171.         gears = 2;
  172.         // TODO: ADD ANIMATION FOR THE HERMIT DROID OR ADDING TO THE INVENTORY
  173.         print("adding item to bin 25");
  174.             
  175.         SetInvAvailable(getlocalplayerthing(), 27, 1);//    Add the large gear to the INV
  176.         ChangeInv(getlocalplayerthing(), 27, 1);
  177.         
  178.         // ChangeInv(getlocalplayerthing(), 16, -1);// Remove the battery from the INV
  179.         //if (GetInv(getlocalplayerthing(), 16) == 0)     //if battery inv bin is 0
  180.         //    {
  181.         //  SetInvAvailable(getlocalplayerthing(), 16, 0);    // Remove the batt from the inv
  182.         //    }
  183.         // TO DO: I remove power from POwer Droid's resources. 
  184.         dwplayplayerresponse();
  185.         //dwSetDialogText("HDC216"); 
  186.         dwPlayCharacterSpeech("HDC220", "T9GK019.wav");        
  187.         dwAddResponse(1, "HDP001","T3xx002.wav",30);         // Return
  188.         }
  189.  
  190.  
  191.     if (ResponseID == 211)    //            # It's a deal Parts 1 and 2
  192.            {
  193.         dwplayplayerresponse();
  194.         gears = 2;
  195.         // TODO: ADD ANIMATION FOR THE HERMIT DROID OR ADDING TO THE INVENTORY
  196.         print("adding item to bin 25");
  197.         ChangeInv(getlocalplayerthing(), 18, -1);// Remove the battery from the INV
  198.         dwcleardialog();
  199.         //dwClearResponses();
  200.         AISetLookFrame(gonk, 2);
  201.         timermode = 1;
  202.         settimer(1);
  203.         //AISetMoveFrame(gonk, 1);
  204.         }
  205.  
  206.     
  207.      if (ResponseID == 212)    //            # No.
  208.            {
  209.         dwplayplayerresponse();
  210.         //dwSetDialogText("HDC214"); 
  211.         dwPlayCharacterSpeech("HDC214", "T9GK017.wav");        
  212.         dwAddResponse(1, "HDP000","T1xx014.wav",60);      // Return
  213.         }
  214.  
  215.      if (ResponseID == 213)    //            I don't have a battery
  216.          {
  217.         dwplayplayerresponse();
  218.         //dwSetDialogText("HDC213"); 
  219.         dwPlayCharacterSpeech("HDC219", "T9GK018.wav");        
  220.         dwAddResponse(1, "HDP000","T1xx014.wav",60);      // Return
  221.         }
  222.         
  223.      if (ResponseID == 219)    //            # I don't a plug/generator
  224.          {
  225.         dwplayplayerresponse();
  226.         //dwSetDialogText("HDC219");// COme back when you have one 
  227.         dwPlayCharacterSpeech("HDC216", "T9GK020.wav");        
  228.         dwAddResponse(1, "HDP000","T1xx014.wav",60);      // Return
  229.         }
  230.  
  231.      if (ResponseID == 300)    //            # FInally tell him
  232.          {
  233.         joke = 4;
  234.         dwplayplayerresponse();
  235.         //dwSetDialogText("HDC300"); 
  236.         dwPlayCharacterSpeech("HDC300", "T9GK009.wav");        
  237.         dwAddResponse(1, "HDP001","T1xx014.wav",60);          // Return
  238.         }
  239.        //-----------------======================================== JOKE SECTION           
  240.     if (ResponseID == 301)    //            Joke #1    Setup    
  241.         {
  242.         dwplayplayerresponse();
  243.         //dwSetDialogText("HDC301"); 
  244.         dwPlayCharacterSpeech("HDC301", "T9GK010.wav");        
  245.         dwAddResponse(302, "HDP002","T9xx003.wav",73);          // Return
  246.         }
  247.     
  248.     if (ResponseID == 302)    //            Joke #1     Punchline
  249.         {
  250.         joke = 1;
  251.         dwplayplayerresponse();
  252.         //dwSetDialogText("HDC302"); 
  253.         dwPlayCharacterSpeech("HDC302", "T9GK011.wav");        
  254.         dwAddResponse(1, "HDP003","T9xx004.wav",50);       // Return
  255.         dwAddResponse(1, "HDP004","T9xx005.wav",40);             // Return
  256.         }   
  257.         
  258.  
  259.     if (ResponseID == 303)    //            Joke #2    Setup    
  260.         {
  261.         dwplayplayerresponse();
  262.         //dwSetDialogText("HDC303"); 
  263.         dwPlayCharacterSpeech("HDC303", "T9GK012.wav");        
  264.         dwAddResponse(304, "HDP006","T9xx006.wav",73);          // Return
  265.         }
  266.     
  267.     if (ResponseID == 304)    //            Joke #2     Punchline
  268.         {
  269.         joke = 3;
  270.         dwplayplayerresponse();
  271.         //dwSetDialogText("HDC304"); 
  272.         dwPlayCharacterSpeech("HDC304", "T9GK013.wav");        
  273.         dwAddResponse(1, "HDP003","T9xx004.wav",50);       // Return
  274.         dwAddResponse(1, "HDP004","T9xx005.wav",40);             // Return
  275.         }
  276.  
  277.  
  278.     if (ResponseID == 305)    //            Joke #3    Setup    
  279.         {
  280.         dwplayplayerresponse();
  281.         //dwSetDialogText("HDC305"); 
  282.         dwPlayCharacterSpeech("HDC305", "T9GK014.wav");        
  283.         dwAddResponse(306, "HDP010","T7xx018.wav",73);       // Return
  284.         }
  285.     
  286.     if (ResponseID == 306)    //            Joke #3     Punchline
  287.         {
  288.         joke = 4;
  289.         dwplayplayerresponse();
  290.         //dwSetDialogText("HDC306"); 
  291.         dwPlayCharacterSpeech("HDC306", "T9GK015.wav");        
  292.         dwAddResponse(1, "HDP003","T9xx004.wav",50);       // Return
  293.         dwAddResponse(1, "HDP004","T9xx005.wav",40);             // Return
  294.         }
  295.         
  296.     if (ResponseID == 400)    //            # bye
  297.         {
  298.         dwplayplayerresponse();
  299.         //dwSetDialogText("JAC401");  
  300.         
  301.         dwCleardialog();
  302.         // Terminate the conversation
  303.           met = 1;      //Reset the greeting 
  304.         ConversationActive=0;
  305.         ShuffleTracks(2, 3, 4, 5);
  306.         dwunfreezeplayer();
  307.         }
  308.         }
  309. return;
  310.      
  311. arrived:
  312.  
  313.  
  314. timer:
  315.     // Used to create the large gear. 
  316.     if (timermode == 1)
  317.         {
  318.         thing_i = creatething(large_gear,gear_ghost);
  319.         capturething(thing_i);
  320.         AISetLookFrame(gonk, 1);
  321.         if (GetInv(getlocalplayerthing(), bat_i) == 0)     //if battery inv bin is 0
  322.             {
  323.             SetInvAvailable(getlocalplayerthing(), bat_i, 0);    // Remove the batt from the inv
  324.             }
  325.         //dwSetDialogText("HDC211"); 
  326.         dwplaycharacterspeech("HDC211","T9GK016.wav");
  327.         dwAddResponse(1, "HDP001","T3xx002.wav",60);        // Return
  328.         }
  329.     else if (timermode == 2)
  330.         {
  331.         //nothing anymore
  332.         }
  333.      
  334.     return;
  335. return;
  336. end
  337.  
  338.  
  339.